class Points():
    def __init__(self,x=0.0,y=0.0,z=0.0):
        self.px=x
        self.py=y
        self.pz=z

    def get_pos(self):
        return self.px,self.py,self.pz

class cellbase():
    def __init__(self):
        self.base=[]

    def set_base(self,x,y,z):
        self.base.append(Points(x,y,z))
        return self

    def get_nbase(self):
        return len(self.base)

    def get_pos(self,n):
        return self.base[n].get_pos()

class PointDefect(Points):
    def __init__(self,x,y,z,defect_type):
        Points.__init__(self,x,y,z)
        # 0 : Vacancy
        # 2 : SIA
        # 3 : Odd
        self.dtype=defect_type

    def getx(self):
        return self.get_pos()[0]

    def gety(self):
        return self.get_pos()[1]

    def getz(self):
        return self.get_pos()[2]

    def get_defect_type(self):
        return self.dtype

class PointList():
    def __init__(self):
        self.plist=[]

    def add_points(self,x,y,z):
        self.plist.append(Points(x,y,z))

    def init_points(self):
        self.plist=[]

    def get_nplist(self):
        return len(self.plist)

    def get_pos(self,n):
        return self.plist[n].get_pos()

class basis():
    def __init__(self):
        # self.basepoint=[]
        self.AtomList=[]

    # def add_basepoint(self,n):
    #     self.basepoint=[0]*n

    # def count_basepoint(self,n):
    #     self.basepoint[n]+=1

    # def get_basepoint(self,n):
    #     return self.basepoint[n]

    # def set_basepoint(self,n,val):
    #     self.basepoint[n]=val
    #     return self

    def set_atomlist_in_unitcell(self,n):
        for i in range(n):
            self.AtomList.append(PointList())

    def add_atom(self,n,x,y,z):
        self.AtomList[n].add_points(x,y,z)

    def init_atomlist_in_unitcell(self,n):
        self.AtomList[n].init_points()

    def get_natom(self,n):
        return self.AtomList[n].get_nplist()

    def get_pos(self,n1,n2):
        return self.AtomList[n1].get_pos(n2)

